import {
    createApp
} from 'vue'
import App from './App.vue'

//引入公共的样式
import "@/assets/css/common.css"

//引入 element-plus 组件
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
//引入 nprogress 样式
import "nprogress/nprogress.css"
//引入路由模块
import router from "@/router"
//引入中文模块
import local from "element-plus/dist/locale/zh-cn.js"
const app = createApp(App)
// app.config.globalProperties.$imgUrl = 'http://127.0.0.1:8888/api/private/v1/'
app.config.globalProperties.$imgUrl = 'http://146.56.230.35:8888/api/private/v1/'
app.config.globalProperties.$formatTime = function (v) {
    // flag = true v是合法的日期参数， 反之不合法
    let flag = !Number.isNaN(Number(new Date(v))),
        date = null
    if (!flag) {
        // 不是合法的日期
        date = new Date()
    } else {
        date = new Date(v)
    }
    let y = date.getFullYear(),
        mon = (date.getMonth() + 1 + '').padStart(2, '0'),
        d = (date.getDate() + '').padStart(2, '0'),
        h = (date.getHours() + '').padStart(2, '0'),
        m = (date.getMinutes() + '').padStart(2, '0'),
        s = (date.getSeconds() + '').padStart(2, '0');
    return `${y}-${mon}-${d} ${h}:${m}:${s}`
}
app.use(ElementPlus, {
    local
})
app.use(router)
app.mount('#app')